package com.abyss.util;

import java.util.Calendar;
import java.util.Date;

/**
 * @Date 2020/9/13
 */
public class DateTimeUtil {

    /**
     * 获取开市和闭市时间
     */

    public static Long openTime;//开市
    public static Long closeTime;//闭市


    static {

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());//设置当天时间
        calendar.set(Calendar.HOUR_OF_DAY,9);
        calendar.set(Calendar.MINUTE,30);
        calendar.set(Calendar.SECOND,0);
        //获取开市时间
        openTime = calendar.getTime().getTime();

        calendar.set(Calendar.HOUR_OF_DAY,15);
        calendar.set(Calendar.MINUTE,0);
        calendar.set(Calendar.SECOND,0);
        //获取闭市时间
        closeTime = calendar.getTime().getTime();
    }


    public static void main(String[] args) {

        System.out.println(openTime);
        System.out.println(closeTime);
    }

}
